Optimal. Leaf size=183 \[ \frac {\left (a^2 c-b^2 c-2 a b d\right ) x}{\left (a^2+b^2\right )^2 \left (c^2+d^2\right )}+\frac {b^2 \left (2 a b c-3 a^2 d-b^2 d\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right )^2 (b c-a d)^2 f}+\frac {d^3 \log (c \cos (e+f x)+d \sin (e+f x))}{(b c-a d)^2 \left (c^2+d^2\right ) f}-\frac {b^2}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.32, antiderivative size = 183, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.120, Rules used = {3650, 3732,
3611} \begin {gather*} \frac {x \left (a^2 c-2 a b d-b^2 c\right )}{\left (a^2+b^2\right )^2 \left (c^2+d^2\right )}-\frac {b^2}{f \left (a^2+b^2\right ) (b c-a d) (a+b \tan (e+f x))}+\frac {b^2 \left (-3 a^2 d+2 a b c-b^2 d\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right )^2 (b c-a d)^2}+\frac {d^3 \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right ) (b c-a d)^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3611
Rule 3650
Rule 3732
Rubi steps
\begin {align*} \int \frac {1}{(a+b \tan (e+f x))^2 (c+d \tan (e+f x))} \, dx &=-\frac {b^2}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))}-\frac {\int \frac {-a b c+a^2 d+b^2 d+b (b c-a d) \tan (e+f x)+b^2 d \tan ^2(e+f x)}{(a+b \tan (e+f x)) (c+d \tan (e+f x))} \, dx}{\left (a^2+b^2\right ) (b c-a d)}\\ &=\frac {\left (a^2 c-b^2 c-2 a b d\right ) x}{\left (a^2+b^2\right )^2 \left (c^2+d^2\right )}-\frac {b^2}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))}+\frac {\left (b^2 \left (2 a b c-3 a^2 d-b^2 d\right )\right ) \int \frac {b-a \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{\left (a^2+b^2\right )^2 (b c-a d)^2}+\frac {d^3 \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{(b c-a d)^2 \left (c^2+d^2\right )}\\ &=\frac {\left (a^2 c-b^2 c-2 a b d\right ) x}{\left (a^2+b^2\right )^2 \left (c^2+d^2\right )}+\frac {b^2 \left (2 a b c-3 a^2 d-b^2 d\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right )^2 (b c-a d)^2 f}+\frac {d^3 \log (c \cos (e+f x)+d \sin (e+f x))}{(b c-a d)^2 \left (c^2+d^2\right ) f}-\frac {b^2}{\left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 3.35, size = 302, normalized size = 1.65 \begin {gather*} -\frac {\frac {\left (2 a b c+a^2 d-b^2 d+\frac {\sqrt {-b^2} \left (a^2 c-b^2 c-2 a b d\right )}{b}\right ) \log \left (\sqrt {-b^2}-b \tan (e+f x)\right )}{\left (a^2+b^2\right )^2 \left (c^2+d^2\right )}+\frac {2 b^2 \left (-2 a b c+3 a^2 d+b^2 d\right ) \log (a+b \tan (e+f x))}{\left (a^2+b^2\right )^2 (b c-a d)^2}+\frac {\left (2 a b c+a^2 d-b^2 d+\frac {\sqrt {-b^2} \left (-a^2 c+b^2 c+2 a b d\right )}{b}\right ) \log \left (\sqrt {-b^2}+b \tan (e+f x)\right )}{\left (a^2+b^2\right )^2 \left (c^2+d^2\right )}-\frac {2 d^3 \log (c+d \tan (e+f x))}{(b c-a d)^2 \left (c^2+d^2\right )}+\frac {2 b^2}{\left (a^2+b^2\right ) (b c-a d) (a+b \tan (e+f x))}}{2 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.46, size = 202, normalized size = 1.10
method | result | size |
derivativedivides | \(\frac {\frac {b^{2}}{\left (a d -b c \right ) \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )}-\frac {b^{2} \left (3 a^{2} d -2 a b c +b^{2} d \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a d -b c \right )^{2} \left (a^{2}+b^{2}\right )^{2}}+\frac {\frac {\left (-a^{2} d -2 a b c +b^{2} d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{2} c -2 a b d -b^{2} c \right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{2} \left (c^{2}+d^{2}\right )}+\frac {d^{3} \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (a d -b c \right )^{2} \left (c^{2}+d^{2}\right )}}{f}\) | \(202\) |
default | \(\frac {\frac {b^{2}}{\left (a d -b c \right ) \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )}-\frac {b^{2} \left (3 a^{2} d -2 a b c +b^{2} d \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a d -b c \right )^{2} \left (a^{2}+b^{2}\right )^{2}}+\frac {\frac {\left (-a^{2} d -2 a b c +b^{2} d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{2} c -2 a b d -b^{2} c \right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{2} \left (c^{2}+d^{2}\right )}+\frac {d^{3} \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (a d -b c \right )^{2} \left (c^{2}+d^{2}\right )}}{f}\) | \(202\) |
norman | \(\frac {\frac {a \left (a^{2} c -2 a b d -b^{2} c \right ) x}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (c^{2}+d^{2}\right )}+\frac {b^{2}}{\left (a d -b c \right ) f \left (a^{2}+b^{2}\right )}+\frac {b \left (a^{2} c -2 a b d -b^{2} c \right ) x \tan \left (f x +e \right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (c^{2}+d^{2}\right )}}{a +b \tan \left (f x +e \right )}+\frac {d^{3} \ln \left (c +d \tan \left (f x +e \right )\right )}{f \left (a^{2} c^{2} d^{2}+a^{2} d^{4}-2 a b \,c^{3} d -2 a b c \,d^{3}+b^{2} c^{4}+b^{2} c^{2} d^{2}\right )}-\frac {\left (a^{2} d +2 a b c -b^{2} d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (c^{2}+d^{2}\right )}-\frac {b^{2} \left (3 a^{2} d -2 a b c +b^{2} d \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}\) | \(346\) |
risch | \(-\frac {x}{i a^{2} d +2 i a b c -i b^{2} d -a^{2} c +2 a b d +b^{2} c}-\frac {2 i d^{3} x}{a^{2} c^{2} d^{2}+a^{2} d^{4}-2 a b \,c^{3} d -2 a b c \,d^{3}+b^{2} c^{4}+b^{2} c^{2} d^{2}}-\frac {2 i d^{3} e}{f \left (a^{2} c^{2} d^{2}+a^{2} d^{4}-2 a b \,c^{3} d -2 a b c \,d^{3}+b^{2} c^{4}+b^{2} c^{2} d^{2}\right )}+\frac {6 i b^{2} a^{2} d x}{a^{6} d^{2}-2 a^{5} b c d +a^{4} b^{2} c^{2}+2 a^{4} b^{2} d^{2}-4 a^{3} b^{3} c d +2 a^{2} b^{4} c^{2}+a^{2} b^{4} d^{2}-2 a \,b^{5} c d +b^{6} c^{2}}+\frac {6 i b^{2} a^{2} d e}{f \left (a^{6} d^{2}-2 a^{5} b c d +a^{4} b^{2} c^{2}+2 a^{4} b^{2} d^{2}-4 a^{3} b^{3} c d +2 a^{2} b^{4} c^{2}+a^{2} b^{4} d^{2}-2 a \,b^{5} c d +b^{6} c^{2}\right )}-\frac {4 i b^{3} a c x}{a^{6} d^{2}-2 a^{5} b c d +a^{4} b^{2} c^{2}+2 a^{4} b^{2} d^{2}-4 a^{3} b^{3} c d +2 a^{2} b^{4} c^{2}+a^{2} b^{4} d^{2}-2 a \,b^{5} c d +b^{6} c^{2}}-\frac {4 i b^{3} a c e}{f \left (a^{6} d^{2}-2 a^{5} b c d +a^{4} b^{2} c^{2}+2 a^{4} b^{2} d^{2}-4 a^{3} b^{3} c d +2 a^{2} b^{4} c^{2}+a^{2} b^{4} d^{2}-2 a \,b^{5} c d +b^{6} c^{2}\right )}+\frac {2 i b^{4} d x}{a^{6} d^{2}-2 a^{5} b c d +a^{4} b^{2} c^{2}+2 a^{4} b^{2} d^{2}-4 a^{3} b^{3} c d +2 a^{2} b^{4} c^{2}+a^{2} b^{4} d^{2}-2 a \,b^{5} c d +b^{6} c^{2}}+\frac {2 i b^{4} d e}{f \left (a^{6} d^{2}-2 a^{5} b c d +a^{4} b^{2} c^{2}+2 a^{4} b^{2} d^{2}-4 a^{3} b^{3} c d +2 a^{2} b^{4} c^{2}+a^{2} b^{4} d^{2}-2 a \,b^{5} c d +b^{6} c^{2}\right )}-\frac {2 i b^{3}}{\left (-i a +b \right ) f \left (-a d +b c \right ) \left (i a +b \right )^{2} \left ({\mathrm e}^{2 i \left (f x +e \right )} b +i a \,{\mathrm e}^{2 i \left (f x +e \right )}-b +i a \right )}+\frac {d^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right )}{f \left (a^{2} c^{2} d^{2}+a^{2} d^{4}-2 a b \,c^{3} d -2 a b c \,d^{3}+b^{2} c^{4}+b^{2} c^{2} d^{2}\right )}-\frac {3 b^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i b +a}{i b -a}\right ) a^{2} d}{f \left (a^{6} d^{2}-2 a^{5} b c d +a^{4} b^{2} c^{2}+2 a^{4} b^{2} d^{2}-4 a^{3} b^{3} c d +2 a^{2} b^{4} c^{2}+a^{2} b^{4} d^{2}-2 a \,b^{5} c d +b^{6} c^{2}\right )}+\frac {2 b^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i b +a}{i b -a}\right ) a c}{f \left (a^{6} d^{2}-2 a^{5} b c d +a^{4} b^{2} c^{2}+2 a^{4} b^{2} d^{2}-4 a^{3} b^{3} c d +2 a^{2} b^{4} c^{2}+a^{2} b^{4} d^{2}-2 a \,b^{5} c d +b^{6} c^{2}\right )}-\frac {b^{4} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i b +a}{i b -a}\right ) d}{f \left (a^{6} d^{2}-2 a^{5} b c d +a^{4} b^{2} c^{2}+2 a^{4} b^{2} d^{2}-4 a^{3} b^{3} c d +2 a^{2} b^{4} c^{2}+a^{2} b^{4} d^{2}-2 a \,b^{5} c d +b^{6} c^{2}\right )}\) | \(1273\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 389 vs.
\(2 (188) = 376\).
time = 0.58, size = 389, normalized size = 2.13 \begin {gather*} \frac {\frac {2 \, d^{3} \log \left (d \tan \left (f x + e\right ) + c\right )}{b^{2} c^{4} - 2 \, a b c^{3} d - 2 \, a b c d^{3} + a^{2} d^{4} + {\left (a^{2} + b^{2}\right )} c^{2} d^{2}} - \frac {2 \, {\left (2 \, a b d - {\left (a^{2} - b^{2}\right )} c\right )} {\left (f x + e\right )}}{{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} c^{2} + {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} d^{2}} - \frac {2 \, b^{2}}{{\left (a^{3} b + a b^{3}\right )} c - {\left (a^{4} + a^{2} b^{2}\right )} d + {\left ({\left (a^{2} b^{2} + b^{4}\right )} c - {\left (a^{3} b + a b^{3}\right )} d\right )} \tan \left (f x + e\right )} + \frac {2 \, {\left (2 \, a b^{3} c - {\left (3 \, a^{2} b^{2} + b^{4}\right )} d\right )} \log \left (b \tan \left (f x + e\right ) + a\right )}{{\left (a^{4} b^{2} + 2 \, a^{2} b^{4} + b^{6}\right )} c^{2} - 2 \, {\left (a^{5} b + 2 \, a^{3} b^{3} + a b^{5}\right )} c d + {\left (a^{6} + 2 \, a^{4} b^{2} + a^{2} b^{4}\right )} d^{2}} - \frac {{\left (2 \, a b c + {\left (a^{2} - b^{2}\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} c^{2} + {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} d^{2}}}{2 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 766 vs.
\(2 (188) = 376\).
time = 1.51, size = 766, normalized size = 4.19 \begin {gather*} -\frac {2 \, b^{5} c^{3} - 2 \, a b^{4} c^{2} d + 2 \, b^{5} c d^{2} - 2 \, a b^{4} d^{3} + 2 \, {\left (2 \, a^{4} b c^{2} d + 2 \, a^{4} b d^{3} - {\left (a^{3} b^{2} - a b^{4}\right )} c^{3} - {\left (a^{5} + 3 \, a^{3} b^{2}\right )} c d^{2}\right )} f x - {\left (2 \, a^{2} b^{3} c^{3} + 2 \, a^{2} b^{3} c d^{2} - {\left (3 \, a^{3} b^{2} + a b^{4}\right )} c^{2} d - {\left (3 \, a^{3} b^{2} + a b^{4}\right )} d^{3} + {\left (2 \, a b^{4} c^{3} + 2 \, a b^{4} c d^{2} - {\left (3 \, a^{2} b^{3} + b^{5}\right )} c^{2} d - {\left (3 \, a^{2} b^{3} + b^{5}\right )} d^{3}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{2} + 2 \, a b \tan \left (f x + e\right ) + a^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - {\left ({\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} d^{3} \tan \left (f x + e\right ) + {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} d^{3}\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \, {\left (a b^{4} c^{3} - a^{2} b^{3} c^{2} d + a b^{4} c d^{2} - a^{2} b^{3} d^{3} - {\left (2 \, a^{3} b^{2} c^{2} d + 2 \, a^{3} b^{2} d^{3} - {\left (a^{2} b^{3} - b^{5}\right )} c^{3} - {\left (a^{4} b + 3 \, a^{2} b^{3}\right )} c d^{2}\right )} f x\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left ({\left (a^{4} b^{3} + 2 \, a^{2} b^{5} + b^{7}\right )} c^{4} - 2 \, {\left (a^{5} b^{2} + 2 \, a^{3} b^{4} + a b^{6}\right )} c^{3} d + {\left (a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}\right )} c^{2} d^{2} - 2 \, {\left (a^{5} b^{2} + 2 \, a^{3} b^{4} + a b^{6}\right )} c d^{3} + {\left (a^{6} b + 2 \, a^{4} b^{3} + a^{2} b^{5}\right )} d^{4}\right )} f \tan \left (f x + e\right ) + {\left ({\left (a^{5} b^{2} + 2 \, a^{3} b^{4} + a b^{6}\right )} c^{4} - 2 \, {\left (a^{6} b + 2 \, a^{4} b^{3} + a^{2} b^{5}\right )} c^{3} d + {\left (a^{7} + 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} + a b^{6}\right )} c^{2} d^{2} - 2 \, {\left (a^{6} b + 2 \, a^{4} b^{3} + a^{2} b^{5}\right )} c d^{3} + {\left (a^{7} + 2 \, a^{5} b^{2} + a^{3} b^{4}\right )} d^{4}\right )} f\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: NotImplementedError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 542 vs.
\(2 (188) = 376\).
time = 0.57, size = 542, normalized size = 2.96 \begin {gather*} \frac {\frac {2 \, d^{4} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{b^{2} c^{4} d - 2 \, a b c^{3} d^{2} + a^{2} c^{2} d^{3} + b^{2} c^{2} d^{3} - 2 \, a b c d^{4} + a^{2} d^{5}} + \frac {2 \, {\left (a^{2} c - b^{2} c - 2 \, a b d\right )} {\left (f x + e\right )}}{a^{4} c^{2} + 2 \, a^{2} b^{2} c^{2} + b^{4} c^{2} + a^{4} d^{2} + 2 \, a^{2} b^{2} d^{2} + b^{4} d^{2}} - \frac {{\left (2 \, a b c + a^{2} d - b^{2} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{4} c^{2} + 2 \, a^{2} b^{2} c^{2} + b^{4} c^{2} + a^{4} d^{2} + 2 \, a^{2} b^{2} d^{2} + b^{4} d^{2}} + \frac {2 \, {\left (2 \, a b^{4} c - 3 \, a^{2} b^{3} d - b^{5} d\right )} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{4} b^{3} c^{2} + 2 \, a^{2} b^{5} c^{2} + b^{7} c^{2} - 2 \, a^{5} b^{2} c d - 4 \, a^{3} b^{4} c d - 2 \, a b^{6} c d + a^{6} b d^{2} + 2 \, a^{4} b^{3} d^{2} + a^{2} b^{5} d^{2}} - \frac {2 \, {\left (2 \, a b^{4} c \tan \left (f x + e\right ) - 3 \, a^{2} b^{3} d \tan \left (f x + e\right ) - b^{5} d \tan \left (f x + e\right ) + 3 \, a^{2} b^{3} c + b^{5} c - 4 \, a^{3} b^{2} d - 2 \, a b^{4} d\right )}}{{\left (a^{4} b^{2} c^{2} + 2 \, a^{2} b^{4} c^{2} + b^{6} c^{2} - 2 \, a^{5} b c d - 4 \, a^{3} b^{3} c d - 2 \, a b^{5} c d + a^{6} d^{2} + 2 \, a^{4} b^{2} d^{2} + a^{2} b^{4} d^{2}\right )} {\left (b \tan \left (f x + e\right ) + a\right )}}}{2 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 6.97, size = 309, normalized size = 1.69 \begin {gather*} \frac {b^2}{f\,\left (a\,d-b\,c\right )\,\left (a^2+b^2\right )\,\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}-\frac {\ln \left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (d\,\left (3\,a^2\,b^2+b^4\right )-2\,a\,b^3\,c\right )}{f\,\left (a^6\,d^2-2\,a^5\,b\,c\,d+a^4\,b^2\,c^2+2\,a^4\,b^2\,d^2-4\,a^3\,b^3\,c\,d+2\,a^2\,b^4\,c^2+a^2\,b^4\,d^2-2\,a\,b^5\,c\,d+b^6\,c^2\right )}+\frac {d^3\,\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )}{f\,{\left (a\,d-b\,c\right )}^2\,\left (c^2+d^2\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,f\,\left (a^2\,c-b^2\,c-2\,a\,b\,d+a^2\,d\,1{}\mathrm {i}-b^2\,d\,1{}\mathrm {i}+a\,b\,c\,2{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,f\,\left (b^2\,c-a^2\,c+2\,a\,b\,d+a^2\,d\,1{}\mathrm {i}-b^2\,d\,1{}\mathrm {i}+a\,b\,c\,2{}\mathrm {i}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________